home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_13_07
/
ross
/
fclffind.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-01
|
525b
|
25 lines
#include <stdio.h>
#include <string.h>
int fclfFind(int n, char *txt, int m, char *pat, int pos)
{ int i, j, k;
int nmatch = 0;
char *cp;
cp = strchr(txt, pat[pos]);
while (cp)
{ i = cp - txt;
k = i - pos;
for (j=0; j<m && txt[k] == pat[j]; j++)
k++;
if (j == m)
{ nmatch++;
printf("%d \n", i-pos);
cp = strchr(txt+i+m, pat[pos]);
}
else
cp = strchr(txt+i+1, pat[pos]);
}
return(nmatch);
}
Figure 5. First character, low frequency string searching function.